package cn.signalpha.modules.com.entity;

import cn.signalpha.common.enums.StatusEnum;
import cn.signalpha.core.swagger.ApiModelPropertyEnum;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.Alias;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * 实体类
 *
 * @author signalpha
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Alias("com_user")
@TableName("com_user")
@ApiModel(value = "User对象", description = "用户")
public class User implements Serializable {
    private static final long serialVersionUID = 1L;

	@TableId(value = "id", type = IdType.ASSIGN_ID)
	private Long id;

	@ApiModelProperty(value = "上级id")
	private Long parentId;

	@ApiModelProperty(value = "上上级id")
	private Long grandpaId;

	@ApiModelProperty(value = "标签id")
	private String tagId;

	@ApiModelProperty(value = "0冻结 1正常")
	private Integer status;

	@ApiModelProperty(value = "等级")
	private Integer level;

	@ApiModelProperty(value = "账户名")
	private String account;

	@ApiModelProperty(value = "手机号")
	private String mobile;

	@ApiModelProperty(value = "昵称")
	private String nickName;

	@ApiModelProperty(value = "头像")
	private String avatar;

	@ApiModelProperty(value = "性别：0未知 1男 2女")
	private Integer sex;

	@ApiModelProperty(value = "推荐链")
	private String chain;

	@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
	@ApiModelProperty(value = "登录密码")
	private String loginPwd;

	@ApiModelProperty(value = "余额")
	private Double money;

	@ApiModelProperty(value = "积分")
	private Double integral;

	@ApiModelProperty(value = "经验值")
	private Integer exp;

	@DateTimeFormat(pattern ="yyyy-MM-dd")
	@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
	@ApiModelProperty(value = "生日")
	private Date birthday;

	@ApiModelProperty(value = "是否分销员")
	private Integer isPlace;

	@ApiModelProperty(value = "分销员等级")
	private Integer placeLevel;

	@ApiModelProperty(value = "分销员状态")
	@ApiModelPropertyEnum(StatusEnum.class)
	private Integer placeStatus;

	@ApiModelProperty(value = "备注")
	private String remark;

	@ApiModelProperty(value = "创建时间")
	private Date createTime;

	@ApiModelProperty(value = "更新时间")
	private Date updateTime;

	@ApiModelProperty(value = "绑定上级时间")
	private Date bindingTime;

	@Version
	@ApiModelProperty(value = "乐观锁")
	private Integer version;

}
